package com.spring.design.flyweight;

/**
 * 享元模式(池的地方用)  JKD源码  Integer . valueOf
 */
public class Client {
    public static void main(String[] args) {

        //创建一个工厂类
        WebSiteFactory factory = new WebSiteFactory();

        //客户要以新闻形式发布的网站
        WebSite webSite1 = factory.getWebSiteCategorg("新闻");
        webSite1.use(new User("tom"));

        //客户要以博客的形式发布网站
        WebSite webSite2 = factory.getWebSiteCategorg("博客");
        webSite2.use(new User("jack"));

        //客户要以博客的形式发布网站
        WebSite webSite3 = factory.getWebSiteCategorg("博客");
        webSite3.use(new User("smith"));

        //客户要以博客的形式发布网站
        WebSite webSite4 = factory.getWebSiteCategorg("电视");
        webSite4.use(new User("king"));

        //客户要以博客的形式发布网站
        WebSite webSite5 = factory.getWebSiteCategorg("电视");
        webSite5.use(new User("hehe"));

        System.out.println("网站的分类总共=" + factory.getWebSiteConut());

    }
}
